<?php
require_once BACKGROUND_COMMON_ACTION_SERVICE_DIR . '/default.php';

class background_order_edit_action_service extends background_default_common_action_service
{
    protected static $_instance;

    public static function get_instance()
    {
        if (null === self::$_instance) {
            self::$_instance = new self();
        }

        return self::$_instance;
    }


    protected function _current_page_process()
    {                	                 
        $result = array('status' => 0, 'message' => '', 'data' => array());

        $request_data = $_GET;
    
        $id = init_user_data_key($request_data, 'id', 'int');
        
        $model_background_order = wwy_resource_container::get_model_background_order();
        //var_dump($model_background_order); exit();
        $order_info = $model_background_order->find($id);
        //var_dump($order_info); exit();
        if(empty($order_info)){                
            $result['status']  = -400;
            $result['message'] = '该订单不存在';
        }else{    
            $model_background_order_good = wwy_resource_container::get_model_background_order_good();
            $where = array('order_id' => $id);
            $order_good_list = $model_background_order_good->fetch_all($where);
            //var_dump($order_good_list); exit();
        
            self::add_view_data('order_info', $order_info);
            self::add_view_data('order_good_list', $order_good_list);
        }

         
        self::set_view_status($result['status']);
        self::set_view_message($result['message']);
    }
}